package edu.oregonstate.vision;

import matlabcontrol.MatlabConnectionException;
import matlabcontrol.MatlabProxy;
import matlabcontrol.MatlabProxyFactory;
import matlabcontrol.extensions.MatlabTypeConverter;

public class MatlabFacade {

	private static MatlabProxyFactory factory = null;
	private static MatlabProxy proxy = null;
	private static MatlabTypeConverter processor = null;

	public static MatlabProxy getMatlabProxy() {
		if (factory == null) {
			factory = new MatlabProxyFactory();
		}
		if (proxy == null) {
			try {
				proxy = factory.getProxy();
			} catch (MatlabConnectionException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return proxy;
	}

	public static MatlabTypeConverter getProcessor() {
		if (processor == null) {
			processor = new MatlabTypeConverter(proxy);
		}
		return processor;
	}
}
